package com.rm.zeyou.pay.alipay.controller;

import com.alipay.api.AlipayApiException;
import com.rm.zeyou.pay.alipay.service.AiliPayNotifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author ZhangKeChen
 * @date 2022/8/19
 */
@Slf4j
@RestController
@RequestMapping("/api/alipay")
public class AiliPayNotifyController {

    @Resource
    private AiliPayNotifyService ailiPayNotifyService;

    /**
     * 常规服务订单回掉
     *
     * @param request
     * @return
     * @throws AlipayApiException
     */
    @PostMapping("/notify")
    public String notify(HttpServletRequest request) throws Exception {
        return ailiPayNotifyService.notify(request);
    }

    /**
     * 升级服务订单回掉
     *
     * @param request
     * @return
     * @throws AlipayApiException
     */
    @PostMapping("/upgradeNotify")
    public String upgradeNotify(HttpServletRequest request) throws Exception {
        return ailiPayNotifyService.upgradeNotify(request);
    }

    /**
     * 加钟服务订单回掉
     *
     * @param request
     * @return
     * @throws AlipayApiException
     */
    @PostMapping("/bellNotify")
    public String bellNotify(HttpServletRequest request) throws Exception {
        return ailiPayNotifyService.bellNotify(request);
    }

    /**
     * 项目 充值支付回掉
     *
     * @param request
     * @return
     * @throws AlipayApiException
     */
    @PostMapping("/rechargeNotify")
    public String rechargeNotify(HttpServletRequest request) throws AlipayApiException {
        return ailiPayNotifyService.rechargeNotify(request);
    }




}
